package com.andong.controller;

import com.andong.annotations.AccessControl;
import com.andong.domain.entity.MockTestScore;
import com.andong.domain.pojo.Result;
import com.andong.service.MockTestScoreService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.andong.utils.SystemConstant.*;

/**
 * 学员模拟考试历史成绩表(MockTestScore)表控制层
 *
 * @author makejava
 * @since 2024-02-13 10:27:35
 */
@RestController
@RequestMapping("mockTestScore")
public class MockTestScoreController {
    /**
     * 服务对象
     */
    @Resource
    private MockTestScoreService mockTestScoreService;

    @PutMapping()
    @AccessControl(roles = STUDENT)
    public Result insert(@RequestBody MockTestScore mockTestScore) {
        mockTestScoreService.save(mockTestScore);
        return Result.success();
    }

    @GetMapping("/{id}")
    @AccessControl(roles = {STUDENT, COACH})
    public Result getById(@PathVariable Long id) {
        return mockTestScoreService.getScoreById(id);
    }
}

